<template>
	<div>User组件---{{ msg }}---{{ count }}</div>
	<br>
	<br>
	<button @click="setMsg">执行方法改变msg</button>
</template>

<script lang="ts">
	import { computed, defineComponent } from "vue";
	import { useStore } from "vuex";
	export default defineComponent({
		setup() {
			const store = useStore();

			return {
				msg: computed(() => {
					return store.state.msg
				}),
				count: computed(() => {
					return store.state.count
				}),
				setMsg: () : void => {
					store.commit("setMsg", "组合式api里面改变后的数据")
				}
			}
		}
	});
</script>

<style lang="scss"></style>